From 2b7b833e045bbaa7c7710257a4349ca93cb1eba0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 26 Feb 2004 20:51:02 +0000 Subject: [PATCH] Fixes for #12804 and #134722, Damon Chaplin: Thu Feb 26 21:52:58 2004 Matthias Clasen Fixes for #12804 and #134722, Damon Chaplin: * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start): Ref and sink the cell renderers here. * gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell renderers here, and free attributes and func_data. --- ChangeLog | 11 +++++++++++ ChangeLog.pre-2-10 | 11 +++++++++++ ChangeLog.pre-2-4 | 11 +++++++++++ ChangeLog.pre-2-6 | 11 +++++++++++ ChangeLog.pre-2-8 | 11 +++++++++++ gtk/gtkcombobox.c | 26 +++++++++++++++++++++++++- 6 files changed, 80 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2de2b3e658..d2017a6d84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Thu Feb 26 21:52:58 2004 Matthias Clasen + + Fixes for #12804 and #134722, Damon Chaplin: + + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start): + Ref and sink the cell renderers here. + + * gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell + renderers here, and free attributes and func_data. + Thu Feb 26 21:41:38 2004 Matthias Clasen * gtk/gtkrc.c (gtk_rc_reset_styles): Mark as 2.4 API addition. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 2de2b3e658..d2017a6d84 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +Thu Feb 26 21:52:58 2004 Matthias Clasen + + Fixes for #12804 and #134722, Damon Chaplin: + + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start): + Ref and sink the cell renderers here. + + * gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell + renderers here, and free attributes and func_data. + Thu Feb 26 21:41:38 2004 Matthias Clasen * gtk/gtkrc.c (gtk_rc_reset_styles): Mark as 2.4 API addition. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 2de2b3e658..d2017a6d84 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,14 @@ +Thu Feb 26 21:52:58 2004 Matthias Clasen + + Fixes for #12804 and #134722, Damon Chaplin: + + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start): + Ref and sink the cell renderers here. + + * gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell + renderers here, and free attributes and func_data. + Thu Feb 26 21:41:38 2004 Matthias Clasen * gtk/gtkrc.c (gtk_rc_reset_styles): Mark as 2.4 API addition. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 2de2b3e658..d2017a6d84 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +Thu Feb 26 21:52:58 2004 Matthias Clasen + + Fixes for #12804 and #134722, Damon Chaplin: + + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start): + Ref and sink the cell renderers here. + + * gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell + renderers here, and free attributes and func_data. + Thu Feb 26 21:41:38 2004 Matthias Clasen * gtk/gtkrc.c (gtk_rc_reset_styles): Mark as 2.4 API addition. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 2de2b3e658..d2017a6d84 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +Thu Feb 26 21:52:58 2004 Matthias Clasen + + Fixes for #12804 and #134722, Damon Chaplin: + + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end): + * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start): + Ref and sink the cell renderers here. + + * gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell + renderers here, and free attributes and func_data. + Thu Feb 26 21:41:38 2004 Matthias Clasen * gtk/gtkrc.c (gtk_rc_reset_styles): Mark as 2.4 API addition. diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 357e5f6954..1ae57c59b7 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -2138,6 +2138,9 @@ gtk_combo_box_cell_layout_pack_start (GtkCellLayout *layout, combo_box = GTK_COMBO_BOX (layout); + g_object_ref (G_OBJECT (cell)); + gtk_object_sink (GTK_OBJECT (cell)); + info = g_new0 (ComboCellInfo, 1); info->cell = cell; info->expand = expand; @@ -2187,6 +2190,9 @@ gtk_combo_box_cell_layout_pack_end (GtkCellLayout *layout, combo_box = GTK_COMBO_BOX (layout); + g_object_ref (G_OBJECT (cell)); + gtk_object_sink (GTK_OBJECT (cell)); + info = g_new0 (ComboCellInfo, 1); info->cell = cell; info->expand = expand; @@ -3005,6 +3011,7 @@ static void gtk_combo_box_finalize (GObject *object) { GtkComboBox *combo_box = GTK_COMBO_BOX (object); + GSList *i; gtk_combo_box_unset_model (combo_box); @@ -3020,7 +3027,24 @@ gtk_combo_box_finalize (GObject *object) if (combo_box->priv->model) g_object_unref (combo_box->priv->model); - g_slist_foreach (combo_box->priv->cells, (GFunc)g_free, NULL); + for (i = combo_box->priv->cells; i; i = i->next) + { + ComboCellInfo *info = (ComboCellInfo *)i->data; + GSList *list = info->attributes; + + if (info->destroy) + info->destroy (info->func_data); + + while (list && list->next) + { + g_free (list->data); + list = list->next->next; + } + g_slist_free (info->attributes); + + g_object_unref (G_OBJECT (info->cell)); + g_free (info); + } g_slist_free (combo_box->priv->cells); G_OBJECT_CLASS (parent_class)->finalize (object); -- 2.30.2